package org.kl.bf.entity.basic;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.kl.bf.entity.AuditableEntity;
import org.kl.bf.entity.Excel;
import org.kl.bf.utils.BasicConstants;

//JPA标识
@Entity
@Table(name = "basic_datadetail")
public class DataDetail extends AuditableEntity {
	private static final long serialVersionUID = 8674494147829941168L;
	@Excel(exportName = "数据内容编号")
	private String dataNo;
	@Excel(exportName = "数据内容名称")
	private String dataName;
	@Excel(exportName = "所属代码表", exportProperty = "codeName")
	private CodeValues dataType;
	/* private String dataType; */
	@Excel(exportName = "数据内容类型")
	private String dataTypeName;
	@Excel(exportName = "是否启用", exportConvertSign = 1)
	private Integer enable = BasicConstants.NO_INT;
	@SuppressWarnings("unused")
	private String pid;

	@ManyToOne
	@JoinColumn(name = "data_type")
	public CodeValues getDataType() {
		return dataType;
	}

	public void setDataType(CodeValues dataType) {
		this.dataType = dataType;
	}

	public String getDataNo() {
		return dataNo;
	}

	public void setDataNo(String dataNo) {
		this.dataNo = dataNo;
	}

	public String getDataName() {
		return dataName;
	}

	public void setDataName(String dataName) {
		this.dataName = dataName;
	}

	/*
	 * public String getDataType() { return dataType; }
	 * 
	 * public void setDataType(String dataType) { this.dataType = dataType; }
	 */

	public Integer getEnable() {
		return enable;
	}

	public void setEnable(Integer enable) {
		this.enable = enable;
	}

	@Transient
	public String getDataTypeName() {
		return dataTypeName;
	}

	public void setDataTypeName(String dataTypeName) {
		this.dataTypeName = dataTypeName;
	}

	@Transient
	public String getPid() {
		return dataType != null ? dataType.getId() : "";
	}

	/**
	 * Excel导出值转换
	 * 
	 * @return
	 */
	public String enableConvert() {
		return enable == 1 ? "是" : "否";
	}

}
